mariadb master-master
on primary server
set the following: /etc/mysql/mariadb.conf.d/50-server.cnf
[mariadb]
log-bin
server_id=1
log-basename=mastermaster
binlog-format=mixed
change to this:
[mysqld]
bind-address = 0.0.0.0
run on both servers:
CREATE USER 'replication_user'@'%' IDENTIFIED BY '***REDACTED***';
GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
-- check status
show master status;
-- after configuring secondary server as SLAVE configure the primary server
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST='***REDACTED***', MASTER_USER='replication_user', MASTER_PASSWORD='***REDACTED***', MASTER_LOG_FILE='mastermaster-bin.000002', MASTER_LOG_POS=1660;
START SLAVE;
SHOW SLAVE STATUS \G
on secondary server
set the following: /etc/mysql/mariadb.conf.d/50-server.cnf
[mariadb]
log-bin
server_id=2
log-basename=mastermaster
binlog-format=mixed
change to this:
[mysqld]
bind-address = 0.0.0.0
run on both servers:
CREATE USER 'replication_user'@'%' IDENTIFIED BY '***REDACTED***';
GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
-- check status
show master status;
-- configure secondary server to replicate from first
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST='***REDACTED***', MASTER_USER='replication_user', MASTER_PASSWORD='***REDACTED***', MASTER_LOG_FILE='mastermaster-bin.000002', MASTER_LOG_POS=1660;
START SLAVE;
SHOW